package com.edu.exam.entity.examination.paper.technical;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import org.hibernate.annotations.CreationTimestamp;
import org.hibernate.annotations.UpdateTimestamp;

import jakarta.persistence.*;
import java.time.LocalDateTime;
import com.edu.exam.enums.examination.paper.ReportType;

/**
 * 识别质量报告实体类
 *
 * 根据E-04-01设备适配子模块数据库设计实现
 * 存储识别过程的质量评估报告。
 *
 * @author System
 * @version 1.0.0
 */

@Entity
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Accessors(chain = true)
public class RecognitionQualityReport {

    /**
     * 报告ID，主键
     */
    @Id
    @Column(name = "report_id", length = 64)
    private String reportId;

    /**
     * 结果ID（外键）
     */
    @Column(name = "result_id", length = 64, nullable = false)
    private String resultId;

    /**
     * 考试ID
     */
    @Column(name = "exam_id", length = 64, nullable = false)
    private String examId;

    /**
     * 报告类型
     */
    @Enumerated(EnumType.STRING)
    @Column(name = "report_type", length = 32, nullable = false)
    private ReportType reportType;

    /**
     * 总体质量分数
     */
    @Column(name = "overall_quality", precision = 5, scale = 2, nullable = false)
    private Double overallQuality;

    /**
     * 准确性指标
     */
    @Column(name = "accuracy_metrics", columnDefinition = "TEXT")
    private String accuracyMetrics;

    /**
     * 一致性指标
     */
    @Column(name = "consistency_metrics", columnDefinition = "TEXT")
    private String consistencyMetrics;

    /**
     * 异常摘要
     */
    @Column(name = "anomaly_summary", columnDefinition = "TEXT")
    private String anomalySummary;

    /**
     * 质量问题
     */
    @Column(name = "quality_issues", columnDefinition = "TEXT")
    private String qualityIssues;

    /**
     * 改进建议
     */
    @Column(name = "improvement_suggestions", columnDefinition = "TEXT")
    private String improvementSuggestions;

    /**
     * 生成时间
     */
    @Column(name = "generated_time", nullable = false)
    private LocalDateTime generatedTime;

    // ================================
    // 审计字段
    // ================================

    @CreationTimestamp
    @Column(name = "created_time", nullable = false, updatable = false)
    private LocalDateTime createdTime;

    @UpdateTimestamp
    @Column(name = "updated_time")
    private LocalDateTime updatedTime;

    @Version
    @Column(name = "version")
    private Integer version = 0;

    @Column(name = "is_deleted")
    private Boolean isDeleted = false;
}